package com.trainsmart.smartmvc
{
	public class FlowUtil
	{
		private var _context:Context;
				
		private static var META_FLOW:String = "meta-flow";	
		private static var CONTAINER:String = "flow-container";
			
		public function FlowUtil(context:Context)
		{
			_context = context;	
		}
		
		public function get metaflows():Array
		{
			
			var obj:Object = _context.getInSession(META_FLOW);
			if(obj==null){
				var meta:Array = new Array();
				_context.putInSession(META_FLOW,meta);
				return meta;
			}else
			return obj as Array;			
		}
		
		public function set metaflows(value:Array):void
		{
			_context.putInSession(META_FLOW,value);
		}
		
		public function keepContainer(container:FlowContainer):void{
			_context.putInSession(CONTAINER,container);
		}
		
		public function forwardStep(stepId:String,currentId:String, request:Object=null, response:Function=null):void
		{
			var container:FlowContainer = _context.getInSession(CONTAINER) as FlowContainer;
			container.forwardStep(stepId,currentId,request, response);			
		}
		

	}
}